package day_2022_9_to_12.Day;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @author haomin
 * @date 2022/09/12 23:38
 **/
public class Day10_6_Num448_FindDisappearedNumbers {
    class Solution {
        public List<Integer> findDisappearedNumbers(int[] nums) {
            List<Integer> res = new ArrayList<>();
            Map<Integer, Integer> map = new HashMap<>();
            for(int num : nums) {
                map.put(num, map.getOrDefault(num, 0) + 1);
            }
            for(int i = 1; i <= nums.length; ++i){
                if(!map.containsKey(i))
                    res.add(i);
            }
            return res;
        }
    }
}